package test;

import java.util.List;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;


import com.tox.dao.JavatoxUserDAO;
import com.tox.dao.pojo.JavatoxUser;
import com.tox.dao.pojo.JavatoxWeibo;
import com.tox.service.ToxUserService;
import com.tox.service.WeiboService;



public class test {
	@Test
	public void add(){
		ApplicationContext context=new ClassPathXmlApplicationContext("applicationContext.xml");
		JavatoxUserDAO userDao=context.getBean("toxUserDao",JavatoxUserDAO.class);
		JavatoxUser user=new JavatoxUser();
		
		
		userDao.register("gqb1", "gqb101112","hqnq");
	}
	@Test
	public void register(){
		ClassPathXmlApplicationContext context=new ClassPathXmlApplicationContext("applicationContext.xml");
		ToxUserService userService=(ToxUserService) context.getBean("toxUserService");
		userService.register("gqb3", "gqb101112","hdq");
	}
	@Test
	public void login(){
		ClassPathXmlApplicationContext context=new ClassPathXmlApplicationContext("applicationContext.xml");
		ToxUserService userService=(ToxUserService) context.getBean("toxUserService");
		userService.login("d20041990@163.com", "gqb101112");
	}
	@Test
	public void weiboList(){
		ClassPathXmlApplicationContext context=new ClassPathXmlApplicationContext("applicationContext.xml");
		WeiboService weiboService=(WeiboService) context.getBean("WeiboService");
		List<JavatoxWeibo> list=weiboService.weiboList();
		for (JavatoxWeibo javatoxWeibo : list) {
			System.out.println(javatoxWeibo.toString());
		}
	}
}
